import React from "react";
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import * as counterActions from "../store/actions/conter.actions.js"

function Counter(props) {
    const { count, add, deletes, add_async } = props
    console.log(props)
    return <div>
        <button onClick={() => { add(1) }}>+</button>
        <span>{count}</span>
        <button onClick={() => { deletes(5) }}>-</button>
    </div>
}

const mapstateProps = state => ({
    count: state.count,
})

const mapdispatchProps = dispatch => bindActionCreators(counterActions, dispatch)



export default connect(mapstateProps, mapdispatchProps)(Counter)